<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Ext.data.Record</title>
        <link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
        <link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
        <link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
        <!-- GC -->
    </head>
    <body>
            <div class="body-wrap">
        <div class="top-tools">
        	<img src="../resources/print.gif" width="16" height="16" align="absmiddle">&nbsp;<a href="Ext.data.Record.html" target="_blank">Print Friendly</a><br/>

        </div>
        <h1>Class Ext.data.Record</h1>
        <table cellspacing="0">
            <tr><td class="label">Package:</td><td>Ext.data</td></tr>
            <tr><td class="label">Class:</td><td>Record</td></tr>
                        <tr><td class="label">Extends:</td><td>Object</td></tr>
                                    <tr><td class="label">Defined In:</td><td><a href="Record.jss.html">Record.js</a></td></tr>
        </table>
        <div class="description">
            Instances of this class encapsulate both record <em>definition</em> information, and record
<em>value</em> information for use in <a ext:cls="Ext.data.Store" href="Ext.data.Store.html">Ext.data.Store</a> objects, or any code which needs
to access Records cached in an <a ext:cls="Ext.data.Store" href="Ext.data.Store.html">Ext.data.Store</a> object.<br>
<p>
Constructors for this class are generated by passing an Array of field definition objects to <a ext:cls="Ext.data.Record" ext:member="create" href="Ext.data.Record.html#create">create</a>.
Instances are usually only created by <a ext:cls="Ext.data.Reader" href="Ext.data.Reader.html">Ext.data.Reader</a> implementations when processing unformatted data
objects.<br>
<p>
Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.        </div>
        <br />
        	<a href="#properties">Properties</a>
			&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#methods">Methods</a>
			&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#events">Events</a>
        	        <hr />
        <a name="properties"></a>
        <h2>Public Properties</h2>
                <table cellspacing="0" class="member-table">
            <tr>
                <th class="sig-header" colspan="2">Property</th>
                <th class="msource-header">Defined By</th>
            </tr>
                <tr class="">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#dirty">dirty</a> : Boolean</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class="">
        <td class="mdesc">Readonly flag - true if this record has been modified.</td>
    </tr>
            </table>
                <a name="methods"></a>
        <h2>Public Methods</h2>
                <table cellspacing="0" class="member-table">
            <tr>
                <th class="sig-header" colspan="2">Method</th>
                <th class="msource-header">Defined By</th>
            </tr>
                <tr class="" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><b>Record</b>(&nbsp;<code>Array data</code>, <span class="optional" title="Optional">[<code>Object id</code>]</span>&nbsp;)</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class="" expandable>
        <td class="mdesc">This constructor should not be used to create Record objects. Instead, use the constructor generated by
create. The p...</td>
    </tr>
        <tr class=" alt" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#commit">commit</a>() : void</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class=" alt" expandable>
        <td class="mdesc">Usually called by the Ext.data.Store which owns the Record.
Commits all changes made to the Record since either creat...</td>
    </tr>
        <tr class="">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#copy">copy</a>(&nbsp;<span class="optional" title="Optional">[<code>String id</code>]</span>&nbsp;) : Record</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class="">
        <td class="mdesc">Creates a copy of this record.</td>
    </tr>
        <tr class=" alt">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#create">create</a>(&nbsp;<span class="optional" title="Optional">[<code>Array o</code>]</span>&nbsp;) : void</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class=" alt">
        <td class="mdesc">&lt;static&gt; Generate a constructor for a specific record layout.</td>
    </tr>
        <tr class="">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#get">get</a>(&nbsp;<code>String name</code>&nbsp;) : Object</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class="">
        <td class="mdesc">Get the value of the named field.</td>
    </tr>
        <tr class=" alt" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#reject">reject</a>() : void</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class=" alt" expandable>
        <td class="mdesc">Usually called by the Ext.data.Store which owns the Record.
Rejects all changes made to the Record since either creat...</td>
    </tr>
        <tr class="">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#set">set</a>(&nbsp;<code>String name</code>, <code>Object value</code>&nbsp;) : void</td>
        <td class="msource" rowspan="2">Record</td>
    </tr>
    <tr class="">
        <td class="mdesc">Set the named field to the specified value.</td>
    </tr>
            </table>
                <a name="events"></a>
        <h2>Public Events</h2>
        <div class="no-members">This class has no public events.</div>                            <h2 class="mdetail-head">Property Details</h2>
            <div class="detail-wrap">
                            <a name="dirty"></a>
                <div class="mdetail">
                <h3>dirty</i></h3>
                <code>public Boolean dirty</code>
                <div class="mdetail-desc">
                    Readonly flag - true if this record has been modified.                </div>
                <div class="mdetail-def">This property is defined by Record.</div>
                </div>
                        </div>
        
                    <a name="Record"></a>
            <h2 class="mdetail-head">Constructor Details</h2>
            <div class="detail-wrap">
                <div class="mdetail">
                <h3>Record</i></h3>
                <code>public function Record(&nbsp;<code>Array data</code>, <span class="optional" title="Optional">[<code>Object id</code>]</span>&nbsp;)</code>
                <div class="mdetail-desc">
                This constructor should not be used to create Record objects. Instead, use the constructor generated by
<a ext:cls="Ext.data.Record" ext:member="create" href="Ext.data.Record.html#create">create</a>. The parameters are the same.                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>data</code> : Array<div class="sub-desc">An associative Array of data values keyed by the field name.</div></li><li><code>id</code> : Object<div class="sub-desc">(Optional) The id of the record. This id should be unique, and is used by the
<a ext:cls="Ext.data.Store" href="Ext.data.Store.html">Ext.data.Store</a> object which owns the Record to index its collection of Records. If
not specified an integer id is generated.</div></li>                    </ul>
                </div>
                </div>
                </div>
            </div>
        
                    <h2 class="mdetail-head">Method Details</h2>
            <div class="detail-wrap">
                            <a name="commit"></a>
                <div class="mdetail">
                <h3>commit</i></h3>
                <code>public function commit()</code>
                <div class="mdetail-desc">
                    Usually called by the <a ext:cls="Ext.data.Store" href="Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
Commits all changes made to the Record since either creation, or the last commit operation.
<p>
Developers should subscribe to the <a ext:cls="Ext.data.Store" ext:member="update" href="Ext.data.Store.html#update">Ext.data.Store.update</a> event to have their code notified
of commit operations.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li>None.</li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>void</code></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                            <a name="copy"></a>
                <div class="mdetail alt">
                <h3>copy</i></h3>
                <code>public function copy(&nbsp;<span class="optional" title="Optional">[<code>String id</code>]</span>&nbsp;)</code>
                <div class="mdetail-desc">
                    Creates a copy of this record.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>id</code> : String<div class="sub-desc">(optional) A new record id if you don't want to use this record's id</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>Record</code></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                            <a name="create"></a>
                <div class="mdetail">
                <h3>create</i></h3>
                <code>public function create(&nbsp;<span class="optional" title="Optional">[<code>Array o</code>]</span>&nbsp;)</code>
                <div class="mdetail-desc">
                    &lt;static&gt; Generate a constructor for a specific record layout.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>o</code> : Array<div class="sub-desc">An Array of field definition objects which specify field names, and optionally,
data types, and a mapping for an <a ext:cls="Ext.data.Reader" href="Ext.data.Reader.html">Ext.data.Reader</a> to extract the field's value from a data object.
Each field definition object may contain the following properties: <ul>
<li><b>name</b> : String<p style="margin-left:1em">The name by which the field is referenced within the Record. This is referenced by,
for example the <em>dataIndex</em> property in column definition objects passed to <a ext:cls="Ext.grid.ColumnModel" href="Ext.grid.ColumnModel.html">Ext.grid.ColumnModel</a></p></li>
<li><b>mapping</b> : String<p style="margin-left:1em">(Optional) A path specification for use by the <a ext:cls="Ext.data.Reader" href="Ext.data.Reader.html">Ext.data.Reader</a> implementation
that is creating the Record to access the data value from the data object. If an <a ext:cls="Ext.data.JsonReader" href="Ext.data.JsonReader.html">Ext.data.JsonReader</a>
is being used, then this is a string containing the javascript expression to reference the data relative to 
the record item's root. If an <a ext:cls="Ext.data.XmlReader" href="Ext.data.XmlReader.html">Ext.data.XmlReader</a> is being used, this is an <a ext:cls="Ext.DomQuery" href="Ext.DomQuery.html">Ext.DomQuery</a> path
to the data item relative to the record element. If the mapping expression is the same as the field name,
this may be omitted.</p></li>
<li><b>type</b> : String<p style="margin-left:1em">(Optional) The data type for conversion to displayable value. Possible values are
<ul><li>auto (Default, implies no conversion)</li>
<li>string</li>
<li>int</li>
<li>float</li>
<li>boolean</li>
<li>date</li></ul></p></li>
<li><b>sortType</b> : Mixed<p style="margin-left:1em">(Optional) A member of <a ext:cls="Ext.data.SortTypes" href="Ext.data.SortTypes.html">Ext.data.SortTypes</a>.</p></li>
<li><b>sortDir</b> : String<p style="margin-left:1em">(Optional) Initial direction to sort. "ASC" or "DESC"</p></li>
<li><b>convert</b> : Function<p style="margin-left:1em">(Optional) A function which converts the value provided
by the Reader into an object that will be stored in the Record. It is passed the
following parameters:<ul>
<li><b>v</b> : Mixed<p style="margin-left:1em">The data value as read by the Reader.</p></li>
</ul></p></li>
<li><b>dateFormat</b> : String<p style="margin-left:1em">(Optional) A format String for the Date.parseDate function.</p></li>
</ul>
<br>usage:<br><pre><code>var TopicRecord = Ext.data.Record.create(
    {name: <em>'title'</em>, mapping: <em>'topic_title'</em>},
    {name: <em>'author'</em>, mapping: <em>'username'</em>},
    {name: <em>'totalPosts'</em>, mapping: <em>'topic_replies'</em>, type: <em>'int'</em>},
    {name: <em>'lastPost'</em>, mapping: <em>'post_time'</em>, type: <em>'date'</em>},
    {name: <em>'lastPoster'</em>, mapping: <em>'user2'</em>},
    {name: <em>'excerpt'</em>, mapping: <em>'post_text'</em>}
);

<b>var</b> myNewRecord = <b>new</b> TopicRecord({
    title: <em>'Do my job please'</em>,
    author: <em>'noobie'</em>,
    totalPosts: 1,
    lastPost: <b>new</b> Date(),
    lastPoster: <em>'Animal'</em>,
    excerpt: <em>'No way dude!'</em>
});
myStore.add(myNewRecord);</code></pre></div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>void</code></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                            <a name="get"></a>
                <div class="mdetail alt">
                <h3>get</i></h3>
                <code>public function get(&nbsp;<code>String name</code>&nbsp;)</code>
                <div class="mdetail-desc">
                    Get the value of the named field.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>name</code> : String<div class="sub-desc">The name of the field to get the value of.</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>Object</code><div class="sub-desc">The value of the field.</div></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                            <a name="reject"></a>
                <div class="mdetail">
                <h3>reject</i></h3>
                <code>public function reject()</code>
                <div class="mdetail-desc">
                    Usually called by the <a ext:cls="Ext.data.Store" href="Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
Rejects all changes made to the Record since either creation, or the last commit operation.
Modified fields are reverted to their original values.
<p>
Developers should subscribe to the <a ext:cls="Ext.data.Store" ext:member="update" href="Ext.data.Store.html#update">Ext.data.Store.update</a> event to have their code notified
of reject operations.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li>None.</li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>void</code></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                            <a name="set"></a>
                <div class="mdetail alt">
                <h3>set</i></h3>
                <code>public function set(&nbsp;<code>String name</code>, <code>Object value</code>&nbsp;)</code>
                <div class="mdetail-desc">
                    Set the named field to the specified value.
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>name</code> : String<div class="sub-desc">The name of the field to set.</div></li><li><code>value</code> : Object<div class="sub-desc">The value to set the field to.</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>void</code></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by Record.</div>
                </div>
                        </div>
        
                
        </div>
    <hr>
    <div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>

    </body>
</html>